<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>
<%@ taglib prefix="other" tagdir="/WEB-INF/tags/other"%>

<head>
	<probiz:pageHeading pageHeadingKey="appMenuList.heading" />
</head>

<content tag="buttons">
	<probiz:iconBtn btnType="moveUp" onclick="upMenu()" disabled="yes"/>
	<probiz:iconBtn btnType="moveDown" onclick="downMenu()" disabled="yes"/>
	<div class="line"></div>
	<probiz:iconBtn btnType="add" onclick="createMenu()" disabled="yes"/>
	<probiz:iconBtn btnType="delete" onclick="delMenu()" disabled="yes"/>	
	<probiz:iconBtn btnType="save" onclick="saveMenu();" disabled="yes"/>
</content>

<div id="contentList">
	<search:searchBox formAction="${ctxPath}/system/frontMenu.html"  enableMoreSearch="false" searchOnclick="searchMenus(true);return false;" formId="menuSearchCriteria">
		<div class="basic_search">
			<table border="0" cellspacing="0" cellpadding="0" class="search_table">
				<tr>
					<th width="60px"><label for="pre_menuName"><fmt:message key="appMenu.menuName" />:</label></th>
					<td>
						<input type="text" id="pre_menuName" name="menuName" value="${param.menuName}" style="width:100px" class="inputtxt"  />&nbsp;
					</td>
					<th width="60px"><label for="pre_title"><fmt:message key="appMenu.title" />:</label></th>
					<td>
						<input type="text" id="pre_title" name="title" value="${param.title}" style="width:100px" class="inputtxt"  />&nbsp;
					</td>
				</tr>
			</table>
		</div>
		<div class="more_search">
		</div>
	</search:searchBox>
	
	<div class="tree">
		<div class="tree_wrap">
			<div class="hd"></div>
				<div class="content" id="menuTree">
					<c:set var="ui_tree" value="true" scope="request"/>
					<ul class="simpleTree">
						<li class="root" id='0'>
							<ul class="tree_root">
							<li id="-11" type="1" class="folder-open-last"><span type="1" depth="0"><fmt:message key="appMenu.type.1" />(${fn:length(menuListMenu)})</span><ul>
								<c:forEach items="${menuListMenu}" var="g1" varStatus="vs1">
								<li id='${g1.menuId}'><span type="1" depth="${g1.depth}" name="${g1.title}">${g1.title}(${fn:length(g1.children)})</span>
										<c:if test="${not empty g1.children}"><ul>
											<c:forEach items="${g1.children}" var="g2" varStatus="vs2">
											<li id='${g2.menuId}'><span type="1" depth="${g2.depth}" name="${g2.title}">${g2.title}(${fn:length(g2.children)})</span>
												<c:if test="${not empty g2.children}"><ul>
													<c:forEach items="${g2.children}" var="g3" varStatus="vs3">
													<li id='${g3.menuId}'><span type="1" depth="${g3.depth}" name="${g3.title}">${g3.title}</span></li></c:forEach>
												</ul></c:if>
											</li></c:forEach>
										</ul></c:if>
								</li></c:forEach>
							</ul></li>
							<li id="-10" type="0" class="folder-open-last"><span type="0" depth="0"><fmt:message key="appMenu.type.0" />(${fn:length(menuListRes)})</span><ul>
								<c:forEach items="${menuListRes}" var="g1" varStatus="vs1">
								<li id='${g1.menuId}'><span type="0" depth="${g1.depth}" name="${g1.title}">${g1.title}(${fn:length(g1.children)})</span>
										<c:if test="${not empty g1.children}"><ul>
											<c:forEach items="${g1.children}" var="g2" varStatus="vs2">
											<li id='${g2.menuId}'><span type="0" depth="${g2.depth}" name="${g2.title}">${g2.title}(${fn:length(g2.children)})</span>
												<c:if test="${not empty g2.children}"><ul>
													<c:forEach items="${g2.children}" var="g3" varStatus="vs3">
													<li id='${g3.menuId}'><span type="0" depth="${g3.depth}" name="${g3.title}">${g3.title}</span></li></c:forEach>
												</ul></c:if>
											</li></c:forEach>
										</ul></c:if>
								</li></c:forEach>
							</ul></li>
							</ul>
						</li>
					</ul>
				</div>
			<div class="ft"></div>
		</div>
	</div>
	<div class="tree_r">
		<div id="menuResults" class="tree_r_wrap">
			<%--ajaxLoad file="/product/include/contentListBody.jspf" --%>
		</div>
	</div>

</div>	
<%-----contentForm的div在装饰器中----%>

<%-----start:list需要加载的JS ----%>
<c:set var="plugin_menuTree" value="true" scope="request"/>
<script type="text/javascript" src="${ctxPath}/scripts/probiz/system/appMenuList.js?rs=${appConfig.rs}"></script>
<%-----end:  list需要加载的JS ----%>

<%-----start:form需要加载的JS ----%>
<c:set var="ui_dialog" value="true" scope="request"/>
<c:set var="ui_tabs" value="true" scope="request"/>
<c:set var="ui_sortable_js" value="true" scope="request"/>
<script type="text/javascript">
/*******************************************
1.ajax请求之前,初始化编辑器，否则无法使用编辑器
2.ajax返回HTML后执行KE.create创建编辑器
3.id是ajax页面中的textarea，要预先设置
*******************************************/

</script>
<%-----end:  form需要加载的JS ----%>
<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		appMenuList_overMaxDepth:"<fmt:message key="appMenuList.overMaxDepth"/>",
		appMenuDetail_save_successed:"<fmt:message key="appMenuDetail.save.successed"/>",
	};
	$j.extend(__FMT, __FMTExtend); 
});
$j(document).ready(function () {
	jMenuTree = $j('#menuTree > ul').simpleTree({
		drag:false,
		afterClick:function(node){
			clickTreeItemAction('adminMenu',$j(node).attr('id'));
		},
		afterDblClick:function(node){
		},
		afterMove:function(destination, source, pos){
		},
		afterAjax:function()
		{
		},
		animate:true
		//,docToFolderConvert:true
	})[0];
	$j("#menuTree").show();
	clickTreeItemAction('frontMenu',${parentId});
});

</script>
